
package com.product.android.ui.activity;

import com.product.android.business.ApplicationVariable;
import com.product.android.business.service.BaseMsgBroadCastReceiver;
import com.product.android.business.service.ReceiveCallback;
import com.product.android.utils.UserIdentityDialog;

import android.content.IntentFilter;
import android.os.Bundle;

public class BaseReceiverFragmentActivity extends BaseFragmentActivity
        implements ReceiveCallback {

    protected BaseMsgBroadCastReceiver baseMsgBroadCastReceiver = null;

    protected boolean registerBroadCast = false;

    @Override
    public void onResume() {
        super.onResume();
        registerReceiverBroad();
        handler_CMD_MyStatus();
        handler_CMD_UserStatus();
        if (ApplicationVariable.INSTANCE.isForceOffline) {
        	UserIdentityDialog.dialogForceOffline(this);
        }
        if (ApplicationVariable.INSTANCE.isIdentityExpired) {
        	UserIdentityDialog.dialogIdentityExpired(this);
        }
    }

    @Override
    protected void onPause() {
        super.onPause();
        unRegisterReceiverBroad();
    }

    protected void unRegisterReceiverBroad() {
        if (registerBroadCast) {
            BaseReceiverFragmentActivity.this
                    .unregisterReceiver(baseMsgBroadCastReceiver);
            registerBroadCast = false;
        }
    }

    protected void registerReceiverBroad() {
        if (registerBroadCast == false) {
            baseMsgBroadCastReceiver = new BaseMsgBroadCastReceiver(this, this);
            IntentFilter filter = new IntentFilter();
            filter.addAction(ApplicationVariable.INSTANCE.applicationContext.getPackageName()+".msg");
            this.registerReceiver(baseMsgBroadCastReceiver, filter);
            registerBroadCast = true;
        }
    }

    public void handler_CMD_Suggest() {
    }

    public void handler_CMD_635() {
    }

    public void handler_CMD_RemoveGroup(Bundle bundle) {
    	handler_CMD_x20004();
    }

    public void handler_CMD_65060(Bundle bundle) {
    }

//    public void handler_CMD_x20005() { //631改为组织树同步
//    }

    public void handler_CMD_12000() {
    }

    public void handler_CMD_GROUP_MEMBER_REFRESH() {
    }

    public void handler_CMD_39() {
    }

    public void handler_CMD_85674() {
    }

    public void handler_CMD_31() {
    }
    

    public void handler_CMD_MyStatus() {
    }

    public void handler_CMD_UserStatus() {
    }

    public void handler_CMD_33() {
    	UserIdentityDialog.dialogForceOffline(this);
    }

    /**
     * 通知上线处理
     */
    public void handler_CMD_36864() {
        handler_CMD_MyStatus();
    }

    /**
     * 个人状态改变
     * 
     * @param bundle
     */
    public void handler_CMD_16() {
        // ImsSendCommand.getInstance().wy_srv_multi_online(fids.length,fids );
        handler_CMD_MyStatus();
        handler_CMD_UserStatus();
    }

    /**
     * 好友状态改变
     * 
     * @param bundle
     */
    public void handler_CMD_51() {
        handler_CMD_UserStatus();
    }

    /**
     * 好友状态改变
     * 
     * @param bundle
     */
    public void handler_CMD_53() {
        handler_CMD_UserStatus();
    }

    public void handler_CMD_5502() {
    	UserIdentityDialog.dialogIdentityExpired(this);
    }

    public void handler_CMD_119() {
        handler_CMD_MyStatus();
        handler_CMD_UserStatus();
    }

    public void handler_CMD_49156(Bundle bundle) {
        handler_CMD_UserStatus();
        handler_CMD_MyStatus();
    }

    public void handler_CMD_30010() {
        handler_CMD_MyStatus();
        handler_CMD_UserStatus();

    }

    public void handler_CMD_AvatarChange() {

    }

    public void handler_CMD_GROUP_SYSMSG_TYPE_GROUP_INFO_CHANGED(Bundle bundle) {
        if (null != bundle && bundle.containsKey("str")) {
            handler_CMD_GROUP_SYSMSG_TYPE_GROUP_INFO_CHANGED(bundle
                    .getString("str"));
        } else {
            handler_CMD_GROUP_SYSMSG_TYPE_GROUP_INFO_CHANGED("");
        }
    }

    public void handler_CMD_GROUP_SYSMSG_TYPE_GROUP_INFO_CHANGED(
            String modifystr) {
    }

    public void handler_CMD_GETAPPINFO() {
    }

    public void handler_CMD_30011() {
        handler_CMD_MyStatus();
        handler_CMD_UserStatus();
        handler_CMD_AvatarChange();
    }

    @Override
    public void handler_CMD_SHOWLEFT() {
        // TODO Auto-generated method stub

    }

    @Override
    public void handler_CMD_SHOWRIGHT() {
        // TODO Auto-generated method stub
    }

    @Override
    public void handler_CMD_89() {
        // TODO Auto-generated method stub

    }

	@Override
	public void handler_CMD_12000(String url) {
		// TODO Auto-generated method stub
		handler_CMD_12000();
	}
	
	@Override
	public void handler_CMD_x20000() {
	}
	
	@Override
	public void handler_CMD_x20002() {
	}
	@Override
	public void handler_CMD_x20003() {
	}
	@Override
	public void handler_CMD_x20004() {
	}
	@Override
	public void handler_CMD_x20005() {
	}
}
